package org.example.operation;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class BigDecimalOper {
    private BigDecimal i1;
    private BigDecimal i2;
    public BigDecimalOper(int i1,int i2){
        this.i1=BigDecimal.valueOf(i1);
        this.i2=new BigDecimal(i2);
    }

    public BigDecimalOper(double i1,double i2){
        this.i1=new BigDecimal(i1+"");
        this.i2=new BigDecimal(i2+"");
    }

    public BigDecimal add(){return i1.add(i2);}

    public BigDecimal subtract(){return i1.subtract(i2);}

    public BigDecimal multiply(){return i1.multiply(i2);}

    public BigDecimal divide(){return i1.divide(i2);}

    public BigDecimal dividePrecise(int scale){return i1.divide(i2,scale, RoundingMode.HALF_UP);}
}
